Skip to content

Conversation

@xav-db
Copy link
Member

@xav-db xav-db commented Nov 25, 2025

Greptile Overview

Greptile Summary

Added validation safeguards to prevent Fly.io deployment failures and schema definition errors.

Key Changes:

  • Enforces 32-character limit on Fly.io app names with clear error messaging
  • Automatically sanitizes project names by replacing underscores with hyphens for Fly.io compatibility
  • Checks for existing Fly.io apps and fly.toml files before deployment to prevent conflicts
  • Implements case-insensitive duplicate field name detection across nodes, edges, and vectors (E109 error)
  • Comprehensive test coverage for all duplicate field scenarios

Important Files Changed

File Analysis

Filename Score Overview
helix-cli/src/commands/integrations/fly.rs 5/5 Added validation for Fly.io app name length (32 char max), underscore replacement with hyphens, and duplicate app checks
helix-db/src/helixc/analyzer/error_codes.rs 5/5 Added E109 error code for duplicate field names in schema definitions
helix-db/src/helixc/analyzer/methods/schema_methods.rs 5/5 Implemented case-insensitive duplicate field detection for nodes, edges, and vectors with comprehensive tests

Sequence Diagram

sequenceDiagram
    participant User
    participant FlyManager
    participant FlyAPI
    participant SchemaAnalyzer

    Note over User,SchemaAnalyzer: Fly.io Deployment Flow

    User->>FlyManager: init_app(instance_name, config)
    FlyManager->>FlyManager: app_name() - sanitize underscores to hyphens
    FlyManager->>FlyManager: Check app_name.len() <= 32
    alt Name too long
        FlyManager-->>User: Error: exceeds MAX_APP_NAME_LENGTH
    end
    
    FlyManager->>FlyManager: read_app_name_from_fly_toml()
    alt fly.toml exists
        FlyManager->>FlyAPI: app_exists(existing_app_name)
        FlyAPI-->>FlyManager: true/false
        alt App exists
            FlyManager-->>User: Error: fly.toml app already exists
        end
    end
    
    FlyManager->>FlyAPI: app_exists(app_name)
    FlyAPI-->>FlyManager: true/false
    alt App exists
        FlyManager-->>User: Error: target app already exists
    end
    
    FlyManager->>FlyAPI: Create app
    FlyAPI-->>User: Success

    Note over User,SchemaAnalyzer: Schema Validation Flow

    User->>SchemaAnalyzer: Define schema with fields
    SchemaAnalyzer->>SchemaAnalyzer: Initialize seen_fields HashSet
    loop For each field
        SchemaAnalyzer->>SchemaAnalyzer: lowercase field name
        SchemaAnalyzer->>SchemaAnalyzer: seen_fields.insert(lower_name)
        alt Duplicate detected
            SchemaAnalyzer->>SchemaAnalyzer: push_schema_err(E109)
        end
        SchemaAnalyzer->>SchemaAnalyzer: Check reserved names
        SchemaAnalyzer->>SchemaAnalyzer: Check field type validity
    end
    SchemaAnalyzer-->>User: Validation complete with diagnostics
Loading

@xav-db
Copy link
Member Author

xav-db commented Nov 25, 2025

@greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

xav-db and others added 5 commits November 24, 2025 23:56
<!-- greptile_comment -->

<h2>Greptile Overview</h2>

<h3>Greptile Summary</h3>


Replaces `panic!()` and `unreachable!()` macros throughout the helixc
compiler with proper error handling using descriptive error messages.

## Key Changes
- **Added two new error codes**: E627 for shortest path algorithms
missing required `from`/`to` parameters, and E628 for invalid `DROP`
usage on non-traversals
- **Replaced 4 panics in graph step validation**: ShortestPath,
ShortestPathDijkstras, ShortestPathBFS, and ShortestPathAStar now return
E627 errors instead of panicking when both `from` and `to` are missing
- **Replaced panic in statement validation**: `DROP` statement now
generates E628 error when applied to non-traversal expressions
- **Replaced 2 panics in traversal validation**: Invalid field value
types now generate E206 errors with `GeneratedValue::Unknown` fallback
- **Replaced 15+ `unreachable!()` calls in parser**: All parser methods
now return descriptive `ParserError` messages for unexpected grammar
rules

## Impact
This PR significantly improves compiler robustness by ensuring invalid
HelixQL queries produce helpful error messages instead of crashing the
compiler. All panic paths have been replaced with proper error
propagation that provides context to users about what went wrong.

<details><summary><h3>Important Files Changed</h3></summary>



File Analysis



| Filename | Score | Overview |
|----------|-------|----------|
| helix-db/src/helixc/analyzer/error_codes.rs | 5/5 | Added two new
error codes (E627 for missing shortest path parameters, E628 for invalid
DROP usage) with proper documentation and implementations |
| helix-db/src/helixc/analyzer/methods/graph_step_validation.rs | 5/5 |
Replaced four `panic!()` calls with proper E627 error generation for
shortest path algorithms missing both from/to parameters |
| helix-db/src/helixc/analyzer/methods/statement_validation.rs | 5/5 |
Replaced panic with E628 error when DROP is applied to non-traversal
expressions |
| helix-db/src/helixc/parser/expression_parse_methods.rs | 5/5 |
Replaced three `unreachable!()` macros with descriptive error messages
for unexpected parser rules |
| helix-db/src/helixc/parser/graph_step_parse_methods.rs | 5/5 |
Replaced four `unreachable!()` macros with proper ParserError for
unexpected rules in order_by and shortest path parsing |

</details>


</details>


<details><summary><h3>Sequence Diagram</h3></summary>

```mermaid
sequenceDiagram
    participant User
    participant Parser
    participant Analyzer
    participant ErrorHandler
    
    Note over Parser,Analyzer: Before: panics on unexpected input
    
    User->>Parser: Submit HelixQL query
    
    alt Unexpected parse rule encountered
        Parser->>Parser: Match rule
        Parser-->>ErrorHandler: Return ParserError with context
        ErrorHandler-->>User: Descriptive error message
    end
    
    alt Valid parse, needs analysis
        Parser->>Analyzer: Pass parsed AST
        
        alt ShortestPath missing from/to
            Analyzer->>Analyzer: Validate graph step
            Analyzer-->>ErrorHandler: generate_error!(E627)
            ErrorHandler-->>User: "requires either `from` or `to` parameter"
        end
        
        alt DROP on non-traversal
            Analyzer->>Analyzer: Validate DROP statement
            Analyzer-->>ErrorHandler: generate_error!(E628)
            ErrorHandler-->>User: "DROP can only be applied to traversals"
        end
        
        alt Invalid field value type
            Analyzer->>Analyzer: Validate field values
            Analyzer-->>ErrorHandler: generate_error!(E206)
            ErrorHandler-->>User: "invalid value type"
        end
    end
    
    Note over Parser,ErrorHandler: After: graceful error handling
```
</details>


<!-- greptile_other_comments_section -->

<!-- /greptile_comment -->
@xav-db xav-db changed the title fix (cli): adding checks for fly cli name length, replacing underscore, and adding checks for duplicate field names fix (cli + hql): adding checks for fly cli name length, replacing underscore, and adding checks for duplicate field names, hql panic removals Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants